<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Input</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="index.html" title="GDK Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Threads.html" title="Threads">
<link rel="next" href="gdk-Input-Devices.html" title="Input Devices">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="reference.html" title="API Reference">
<link rel="index" href="api-index-full.html" title="Index of all symbols">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Threads.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK Reference Manual</th>
<td><a accesskey="n" href="gdk-Input-Devices.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Input.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#gdk-Input.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-Input"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Input.top_of_page"></a>Input</span></h2>
<p>Input — Callbacks on file descriptors</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Input.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk/gdk.h&gt;

<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                <a class="link" href="gdk-Input.html#gdk-input-add-full" title="gdk_input_add_full ()">gdk_input_add_full</a>                  (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition,
                                                         <a class="link" href="gdk-Input.html#GdkInputFunction" title="GdkInputFunction ()">GdkInputFunction</a> function,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy);
enum                <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a>;
void                (<a class="link" href="gdk-Input.html#GdkInputFunction" title="GdkInputFunction ()">*GdkInputFunction</a>)                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition);
void                (<a class="link" href="gdk-Input.html#GdkDestroyNotify" title="GdkDestroyNotify ()">*GdkDestroyNotify</a>)                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                <a class="link" href="gdk-Input.html#gdk-input-add" title="gdk_input_add ()">gdk_input_add</a>                       (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition,
                                                         <a class="link" href="gdk-Input.html#GdkInputFunction" title="GdkInputFunction ()">GdkInputFunction</a> function,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);
void                <a class="link" href="gdk-Input.html#gdk-input-remove" title="gdk_input_remove ()">gdk_input_remove</a>                    (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> tag);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="gdk-Input.description"></a><h2>Description</h2>
<p>
The functions in this section are used to establish
callbacks when some condition becomes true for
a file descriptor. They are currently just wrappers around
the <a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html"
>IO Channel</a>
facility.
</p>
</div>
<div class="refsect1" lang="en">
<a name="gdk-Input.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="gdk-input-add-full"></a><h3>gdk_input_add_full ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                gdk_input_add_full                  (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition,
                                                         <a class="link" href="gdk-Input.html#GdkInputFunction" title="GdkInputFunction ()">GdkInputFunction</a> function,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"
>GDestroyNotify</a> destroy);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_input_add_full</code> is deprecated and should not be used in newly-written code. Use <a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#g-io-add-watch-full"
><code class="function">g_io_add_watch_full()</code></a> on a <a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"
><span class="type">GIOChannel</span></a></p>
</div>
<p>
Establish a callback when a condition becomes true on
a file descriptor.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td>
<td> a file descriptor.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
<td> the condition.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>function</code></em> :</span></p></td>
<td> the callback function.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td> callback data passed to <em class="parameter"><code>function</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>destroy</code></em> :</span></p></td>
<td> callback function to call with <em class="parameter"><code>data</code></em> when the input
handler is removed.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a tag that can later be used as an argument to
<a class="link" href="gdk-Input.html#gdk-input-remove" title="gdk_input_remove ()"><code class="function">gdk_input_remove()</code></a>.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkInputCondition"></a><h3>enum GdkInputCondition</h3>
<pre class="programlisting">typedef enum
{
  GDK_INPUT_READ       = 1 &lt;&lt; 0,
  GDK_INPUT_WRITE      = 1 &lt;&lt; 1,
  GDK_INPUT_EXCEPTION  = 1 &lt;&lt; 2
} GdkInputCondition;
</pre>
<p>
A set of bit flags used to specify conditions for which
an input callback will be triggered. The three members
of this enumeration correspond to the <em class="parameter"><code>readfds</code></em>,
<em class="parameter"><code>writefds</code></em>, and <em class="parameter"><code>exceptfds</code></em> arguments to the
<code class="function">select</code> system call.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-INPUT-READ--CAPS"></a><span class="term"><code class="literal">GDK_INPUT_READ</code></span></p></td>
<td>the file descriptor has become available for reading.
(Or, as is standard in Unix, a socket or pipe was closed
at the other end; this is the case if a subsequent read
on the file descriptor returns a count of zero.)
</td>
</tr>
<tr>
<td><p><a name="GDK-INPUT-WRITE--CAPS"></a><span class="term"><code class="literal">GDK_INPUT_WRITE</code></span></p></td>
<td>the file descriptor has become available for writing.
</td>
</tr>
<tr>
<td><p><a name="GDK-INPUT-EXCEPTION--CAPS"></a><span class="term"><code class="literal">GDK_INPUT_EXCEPTION</code></span></p></td>
<td>an exception was raised on the file descriptor.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkInputFunction"></a><h3>GdkInputFunction ()</h3>
<pre class="programlisting">void                (*GdkInputFunction)                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition);</pre>
<p>
A callback function that will be called when some condition
occurs.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>the user data passed to <a class="link" href="gdk-Input.html#gdk-input-add" title="gdk_input_add ()"><code class="function">gdk_input_add()</code></a> or <a class="link" href="gdk-Input.html#gdk-input-add-full" title="gdk_input_add_full ()"><code class="function">gdk_input_add_full()</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td>
<td>the source where the condition occurred.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
<td>the triggering condition.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="GdkDestroyNotify"></a><h3>GdkDestroyNotify ()</h3>
<pre class="programlisting">void                (*GdkDestroyNotify)                 (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">GdkDestroyNotify</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
A callback function called when a piece of user data is
no longer being stored by GDK. Will typically free the
structure or object that <em class="parameter"><code>data</code></em> points to.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>the user data.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-input-add"></a><h3>gdk_input_add ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                gdk_input_add                       (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> source,
                                                         <a class="link" href="gdk-Input.html#GdkInputCondition" title="enum GdkInputCondition">GdkInputCondition</a> condition,
                                                         <a class="link" href="gdk-Input.html#GdkInputFunction" title="GdkInputFunction ()">GdkInputFunction</a> function,
                                                         <a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"
>gpointer</a> data);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_input_add</code> is deprecated and should not be used in newly-written code. Use <a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#g-io-add-watch"
><code class="function">g_io_add_watch()</code></a> on a <a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html#GIOChannel"
><span class="type">GIOChannel</span></a></p>
</div>
<p>
Establish a callback when a condition becomes true on
a file descriptor.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>source</code></em> :</span></p></td>
<td> a file descriptor.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em> :</span></p></td>
<td> the condition.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>function</code></em> :</span></p></td>
<td> the callback function.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td> callback data passed to <em class="parameter"><code>function</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a tag that can later be used as an argument to
<a class="link" href="gdk-Input.html#gdk-input-remove" title="gdk_input_remove ()"><code class="function">gdk_input_remove()</code></a>.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-input-remove"></a><h3>gdk_input_remove ()</h3>
<pre class="programlisting">void                gdk_input_remove                    (<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a> tag);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_input_remove</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Remove a callback added with <a class="link" href="gdk-Input.html#gdk-input-add" title="gdk_input_add ()"><code class="function">gdk_input_add()</code></a> or
<a class="link" href="gdk-Input.html#gdk-input-add-full" title="gdk_input_add_full ()"><code class="function">gdk_input_add_full()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>tag</code></em> :</span></p></td>
<td>the tag returned when the callback was set up.
</td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="gdk-Input.see-also"></a><h2>See Also</h2>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/glib/glib-The-Main-Event-Loop.html"
>GLib Main Loop</a></span></p></td>
<td><p>The main loop in which input callbacks run.</p></td>
</tr>
<tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/glib/glib-IO-Channels.html"
>IO Channels</a></span></p></td>
<td><p>A newer and more flexible way of doing IO
callbacks.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>
